package gushi;

import java.util.Scanner;

public class gushi {
 public static void main(String []args) {
	 int i = 1;
	 int position =0;
	    int t=0;
	   String gushi =new String("汉皇重色思倾国御宇多年求不得杨家有女初长成养在深闺人未识"
	     + "天生丽质难自弃一朝选在君王侧回眸一笑百媚生六宫粉黛无颜色春寒赐浴华清池温"
	     + "泉水滑洗凝脂侍儿扶起娇无力始是新承恩泽时云鬓花颜金步摇芙蓉帐暖度春宵春宵"
	     + "苦短日高起从此君王不早朝承欢侍宴无闲暇春从春游夜专夜后宫佳丽三千人三千宠"
	     + "爱在一身金屋妆成娇侍夜玉楼宴罢醉和春姊妹弟兄皆列土可怜光彩生门户遂令天下"
	     + "父母心不重生男重生女骊宫高处入青云仙乐风飘处处闻缓歌慢舞凝丝竹尽日君王看"
	     + "不足渔阳鼙鼓动地来惊破霓裳羽衣曲九重城阙烟尘生千乘万骑西南行翠华摇摇行复"
	     + "止西出都门百余里六军不发无奈何宛转蛾眉马前死花钿委地无人收翠翘金雀玉搔头"
	     + "君王掩面救不得回看血泪相和流黄埃散漫风萧索云栈萦纡登剑阁峨嵋山下少人行旌"
	     + "旗无光日色薄蜀江水碧蜀山青圣主朝朝暮暮情行宫见月伤心色夜雨闻铃肠断声天旋"
	     + "地转回龙驭到此踌躇不能去马嵬坡下泥土中不见玉颜空死处君臣相顾尽沾衣东望都"
	     + "门信马归归来池苑皆依旧太液芙蓉未央柳芙蓉如面柳如眉对此如何不泪垂春风桃李"
	     + "花开夜秋雨梧桐叶落时西宫南苑多秋草落叶满阶红不扫梨园弟子白发新椒房阿监青"
	     + "娥老夕殿萤飞思悄然孤灯挑尽未成眠迟迟钟鼓初长夜耿耿星河欲曙天鸳鸯瓦冷霜华"
	     + "重翡翠衾寒谁与共悠悠生死别经年魂魄不曾来入梦临邛道士鸿都客能以精诚致魂魄"
	     + "为感君王辗转思遂教方士殷勤觅排空驭气奔如电升天入地求之遍上穷碧落下黄泉两"
	     + "处茫茫皆不见忽闻海上有仙山山在虚无缥渺间楼阁玲珑五云起其中绰约多仙子中有"
	     + "一人字太真雪肤花貌参差是金阙西厢叩玉扃转教小玉报双成闻道汉家天子使九华帐"
	     + "里梦魂惊揽衣推枕起徘徊珠箔银屏迤逦开云鬓半偏新睡觉花冠不整下堂来风吹仙袂"
	     + "飘飖举犹似霓裳羽衣舞玉容寂寞泪阑干梨花一殿里恩爱绝蓬莱宫中日月长回头下望"
	     + "枝春带雨含情凝睇谢君王一别音容两渺茫昭阳人寰处不见长安见尘雾惟将旧物表深"
	     + "情钿合金钗寄将去钗留一股合一扇钗擘黄金合分钿但令心似金钿坚天上人间会相见"
	     + "临别殷勤重寄词词中有誓两心知七月七日长生殿夜半无人私语时在天愿作比翼鸟在"
	     + "地愿为连理枝天长地久有时尽此恨绵绵无绝期");
	   char[] char_str=gushi.toCharArray();
   	for(char hz:char_str) {
           System.out.print(hz);
           if(i%7==0&&i%14!=0)
           	System.out.print(",");
           if(i%14==0)
               System.out.println("。");
           i++;
   	}
    System.out.println("\n请输入想要查找出现次数的汉字：");
   
    Scanner sc = new Scanner(System.in);
	System.out.println("请输入要检索的字符或字符串");
	String c =sc.next();
	while(gushi.indexOf(c,position)>=0){
	    t++;
	    position=gushi.indexOf(c,position)+c.length();
	}
	System.out.println(c+"出现的次数为:"+t);
   
    
 }}
